import { createRouter, createWebHistory } from 'vue-router'
import ACCESS_ENUM from '@/access/AccessEnum.ts'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '主页',
      component: () => import('@/pages/HomePage.vue'),
      meta: { 
        showHeader: true, 
        showFooter: true 
      }
    },
    {
      path: '/user/login',
      name: '用户登录',
      component: () => import('@/pages/user/UserLoginPage.vue'),
      //隐藏顶部导航栏和底部信息栏
      meta: { 
        showHeader: false, 
        showFooter: false 
      }
    },
    {
      path: '/user/registration',
      name: '用户注册',
      component: () => import('@/pages/user/UserRegistrationPage.vue'),
      //隐藏顶部导航栏和底部信息栏
      meta: { 
        showHeader: false, 
        showFooter: false 
      }
    },
    {
      path: '/user/about',
      name: '关于',
      component: () => import('@/pages/user/AboutPage.vue'),
      meta: { 
        showHeader: true, 
        showFooter: true 
      }
    },
    {
      path: '/user/profile',
      name: '个人信息',
      component: () => import('@/pages/user/UserProfilePage.vue'),
      meta: { 
        showHeader: true, 
        showFooter: true 
      }
    },
    {
      path: '/admin/userManagement',
      name: '用户管理',
      component: () => import('@/pages/admin/UserManagementPage.vue'),
      //需要管理权限
      meta: {
        access: ACCESS_ENUM.ADMIN,
        showHeader: true, 
        showFooter: true 
      }
    },
    {
      path: '/admin/appManagement',
      name: '应用管理',
      component: () => import('@/pages/admin/AppManagementPage.vue'),
      meta: {
        access: ACCESS_ENUM.ADMIN,
        showHeader: true, 
        showFooter: true 
      }
    },
    {
      path: '/admin/chatHistoryManagement',
      name: '对话历史管理',
      component: () => import('@/pages/admin/ChatHistoryManagementPage.vue'),
      meta: {
        access: ACCESS_ENUM.ADMIN,
        showHeader: true, 
        showFooter: true 
      }
    },
    {
      path: '/app/chat/:id',
      name: '应用对话',
      component: () => import('@/pages/app/AppChatPage.vue'),
      meta: {
        showHeader: true, 
        showFooter: false 
      }
    },
    {
      path: '/app/edit/:id',
      name: '编辑应用',
      component: () => import('@/pages/app/AppEditPage.vue'),
      meta: {
        showHeader: true, 
        showFooter: true 
      }
    },
  ],
})

export default router
